From: Doug Goldstein Date: Tue, 1 Dec 2015 19:27:53 +0000 (-0600) Subject: libxc: prefer using privcmd character device X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2140 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=013396f93ee2d4ec416f701ae420c683b7327230;p=xen.git libxc: prefer using privcmd character device Prefer using the character device over the proc file if the character device exists. This follows similar conversions of xenbus to avoid issues with FMODE_ATOMIC_POS added in Linux 3.14 and newer. CC: Ian Jackson CC: Stefano Stabellini CC: Ian Campbell CC: Wei Liu Signed-off-by: Doug Goldstein Acked-by: Wei Liu --- diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c index 76c55ff304..c3a3a140e2 100644 --- a/tools/libxc/xc_linux_osdep.c +++ b/tools/libxc/xc_linux_osdep.c @@ -46,7 +46,13 @@ static xc_osdep_handle linux_privcmd_open(xc_interface *xch) { int flags, saved_errno; - int fd = open("/proc/xen/privcmd", O_RDWR); + int fd = open("/dev/xen/privcmd", O_RDWR); /* prefer this newer interface */ + + if ( fd == -1 && ( errno == ENOENT || errno == ENXIO || errno == ENODEV )) + { + /* Fallback to /proc/xen/privcmd */ + fd = open("/proc/xen/privcmd", O_RDWR); + } if ( fd == -1 ) {